Programmable logic controllers (PLCs) are specialized data processors that are in widespread use in a variety of fields, for example as controllers for machine tools, material handling and assembling systems, for molding and casting machines, and for robotics systems. FIG. 1 presents a simplified diagram of a PLC 12 that includes a plurality of input terminals 14, a plurality of output terminals 16, microprocessor 20, and memory 22. Input terminals 14 and output terminals 16 are collectively referred to as IO points.
PLC 12 operates under the control of a program stored in memory 22. When incorporated into an application, each input terminal 14 will be connected to a switch, a relay contact, or some other device capable of providing an electrical signal indicating one of two states, such as open vs. closed in the case of a switch or relay contact, or high vs. low in the case of a voltage signal. Each output terminal 16 is connected to a device such as a status indicator, a relay coil, etc., that is to be controlled by the PLC.
The PLC operates by repetitively executing what is termed a scan. During each scan, the PLC reads the signals present at input terminals 14, to determine what will here be referred to as input data. Next, the PLC combines the input data with the program stored in memory 22 to determine the corresponding output data. Finally, the PLC uses the output data to set the values of the signals at output terminals 16, and then proceeds to start the next scan.
The program stored in memory 22 and used by the PLC to control its operation is typically expressed in what is termed "ladder logic" format. Each ladder logic program comprises one or more ladder logic statements. In the PLC art, these ladder logic statements are often termed "rungs". Each ladder logic statement defines the relationship between an output variable and, in most cases, one or more input variables. Input variables include variables corresponding to the signals at input terminals 14, while output variables include variables corresponding to the signals at output terminals 16. Other types of input and output variables are described below. A simple ladder logic statement might indicate that a particular output variable is "on" if and only if input variables 1 and 2 are both "on".
For easier comprehension, ladder logic statements and programs are often expressed in terms of ladder logic graphs. A simple ladder logic graph 30 is shown in FIG. 2. The ladder logic graph comprises input symbols 32 and 34, and output symbol 36, interconnected by line segments 40 and 42. Input symbols 32 and 34 are assigned labels or variable names A and B respectively, while variable name C is assigned to output symbol 36. In the convention used in ladder logic graphs, the graph of FIG. 2 is equivalent to the statement that output C is "on" if and only if inputs A and B are both "on", i.e., the equivalent of a logical AND operation between inputs A and B to produce output C. The fact that inputs A and B are ANDed together is indicated by the fact that their input symbols are connected in series by line segment 40. Line segment 42 indicates that the result of A AND B controls output C. Input symbols A and B can be regarded as normally open (i.e., off) switches, and the ladder logic graph can be interpreted by noting that a voltage or other signal present on line segment 44 to the left of the input symbols will reach output point C if and only if switches A and B are both closed (i.e., on).
FIG. 3 represents a second ladder logic graph with inputs A, B, and output C, except that now inputs A and B are connected in parallel by line segments 50 and 52. This ladder logic graph is equivalent to the statement that output C will be on if either input A or input B is on. Thus, the parallel connection provided by line segments 50 and 52 indicates the logical operation OR. As with FIG. 2, the graph of FIG. 3 can be interpreted by noting that a signal present on line segment 50 will reach output C if either switch A or switch B is closed.
In general, two prior methods have been used to permit a user to create ladder logic programs for PLCs. In a first method, the PLC includes an input module that includes a small keyboard. The keyboard typically includes numeric keys, function keys, and a small number of other keys representing different types of variables. The program is entered directly into memory 22 via such a keyboard. For example, to enter the ladder logic statement corresponding to FIG. 3, a user might enter an identifier for input variable A, then press a function key specifying a logical OR operation, then enter a symbol for input variable B, and finally a symbol for output variable C.
A second prior technique for programming PLCs involves creating the ladder logic program on a separate device, such a personal computer, and then transferring the program to memory 22 via a serial data link or the like. In such systems, the operator of personal computer draws a ladder logic graph directly on the computer display screen, one graphical element at a time. When a given ladder logic graph is completed, the PC software converts the graph into the corresponding ladder logic command. The ladder logic commands are then transferred to the PLC and stored in memory 22.